﻿--创建数据库
create database MyShop;
--创建表
USE [MyShop]
GO
/****** Object:  Table [dbo].[SystemButton]    Script Date: 2019/8/8 9:17:20 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[SystemButton](
	[Id] [uniqueidentifier] NOT NULL,
	[ButtonNum] [int] NOT NULL,
	[ButtonName] [varchar](50) NOT NULL,
	[ButtonTag] [varchar](50) NOT NULL,
	[Icons] [varchar](50) NULL,
	[Titles] [varchar](500) NULL,
	[Remarks] [varchar](500) NULL,
	[CreateAt] [datetime] NOT NULL,
	[CreateName] [varchar](50) NOT NULL,
	[CreateId] [uniqueidentifier] NOT NULL,
	[UpdateAt] [datetime] NULL,
	[UpdateName] [varchar](50) NULL,
	[UpdateId] [uniqueidentifier] NULL,
	[IsDel] [bit] NULL,
 CONSTRAINT [PK_SysTemButton] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[SystemLog]    Script Date: 2019/8/8 9:17:21 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[SystemLog](
	[Id] [int] IDENTITY(1,1) NOT NULL,
	[Types] [varchar](50) NOT NULL,
	[Titles] [varchar](2000) NOT NULL,
	[Contents] [varchar](max) NOT NULL,
	[OldData] [varchar](max) NULL,
	[NewData] [varchar](max) NULL,
	[CreateAt] [datetime] NOT NULL,
	[CreateId] [uniqueidentifier] NOT NULL,
	[CreateName] [varchar](50) NULL,
 CONSTRAINT [PK_SystemLog] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object:  Table [dbo].[SystemMenu]    Script Date: 2019/8/8 9:17:21 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[SystemMenu](
	[Id] [uniqueidentifier] NOT NULL,
	[IndexNum] [int] NOT NULL,
	[MemuName] [varchar](50) NOT NULL,
	[Description] [varchar](500) NULL,
	[Remarks] [varchar](500) NULL,
	[AreaStr] [varchar](50) NULL,
	[ControllerStr] [varchar](50) NULL,
	[ActionStr] [varchar](50) NULL,
	[ParentId] [uniqueidentifier] NULL,
	[Icons] [varchar](50) NULL,
	[CreateAt] [datetime] NOT NULL,
	[CreateName] [varchar](50) NOT NULL,
	[CreateId] [uniqueidentifier] NOT NULL,
	[UpdateAt] [datetime] NULL,
	[UpdateName] [varchar](50) NULL,
	[UpdateId] [uniqueidentifier] NULL,
	[IsDel] [bit] NULL,
 CONSTRAINT [PK_SystemMenu] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[SystemMenuButton]    Script Date: 2019/8/8 9:17:21 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[SystemMenuButton](
	[Id] [uniqueidentifier] NOT NULL,
	[MenuId] [uniqueidentifier] NOT NULL,
	[ButtonId] [uniqueidentifier] NOT NULL,
	[Titles] [varchar](500) NOT NULL,
	[ButtonName] [varchar](500) NOT NULL,
	[Icons] [varchar](100) NOT NULL,
 CONSTRAINT [PK_SystemMenuButton] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[SystemRole]    Script Date: 2019/8/8 9:17:21 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[SystemRole](
	[Id] [uniqueidentifier] NOT NULL,
	[RoleName] [varchar](100) NOT NULL,
	[Remarks] [varchar](2000) NULL,
	[CreateAt] [datetime] NOT NULL,
	[CreateName] [varchar](50) NOT NULL,
	[CreateId] [uniqueidentifier] NOT NULL,
	[UpdateAt] [datetime] NULL,
	[UpdateName] [varchar](50) NULL,
	[UpdateId] [uniqueidentifier] NULL,
	[IsDel] [bit] NULL,
 CONSTRAINT [PK_SystemRole] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[SystemRoleFunction]    Script Date: 2019/8/8 9:17:21 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[SystemRoleFunction](
	[Id] [uniqueidentifier] NOT NULL,
	[RoleId] [uniqueidentifier] NOT NULL,
	[MenuId] [uniqueidentifier] NOT NULL,
	[ButtonId] [uniqueidentifier] NULL,
	[CreateAt] [datetime] NOT NULL,
	[CreateName] [varchar](50) NOT NULL,
	[CreateId] [uniqueidentifier] NOT NULL,
	[UpdateAt] [datetime] NULL,
	[UpdateName] [varchar](50) NULL,
	[UpdateId] [uniqueidentifier] NULL,
	[IsDel] [bit] NULL,
 CONSTRAINT [PK_SystemRoleFunction_1] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[SystemUser]    Script Date: 2019/8/8 9:17:21 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[SystemUser](
	[Id] [uniqueidentifier] NOT NULL,
	[Account] [varchar](50) NOT NULL,
	[Name] [varchar](50) NOT NULL,
	[EnglishName] [varchar](100) NULL,
	[Passwd] [varchar](50) NULL,
	[Email] [varchar](50) NULL,
	[MobilePhone] [varchar](50) NULL,
	[IsLogin] [bit] NULL,
	[IsNormal] [bit] NULL,
	[CreateAt] [datetime] NOT NULL,
	[CreateName] [varchar](50) NOT NULL,
	[CreateId] [uniqueidentifier] NOT NULL,
	[UpdateAt] [datetime] NULL,
	[UpdateName] [varchar](50) NULL,
	[UpdateId] [uniqueidentifier] NULL,
	[IsDel] [bit] NULL,
 CONSTRAINT [PK_SystemUser] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  Table [dbo].[SystemUserRole]    Script Date: 2019/8/8 9:17:21 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[SystemUserRole](
	[Id] [int] IDENTITY(1,1) NOT NULL,
	[RoleId] [uniqueidentifier] NOT NULL,
	[UserId] [uniqueidentifier] NOT NULL,
 CONSTRAINT [PK_SystemUserRole] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[SystemButton] ADD  CONSTRAINT [DF_SystemButton_ButtonNum]  DEFAULT ((0)) FOR [ButtonNum]
GO
ALTER TABLE [dbo].[SystemButton] ADD  CONSTRAINT [DF_SysTemButton_CreateAt]  DEFAULT (getdate()) FOR [CreateAt]
GO
ALTER TABLE [dbo].[SystemButton] ADD  CONSTRAINT [DF_SysTemButton_IsDel]  DEFAULT ((0)) FOR [IsDel]
GO
ALTER TABLE [dbo].[SystemLog] ADD  CONSTRAINT [DF_SystemLog_CreateAt]  DEFAULT (getdate()) FOR [CreateAt]
GO
ALTER TABLE [dbo].[SystemMenu] ADD  CONSTRAINT [DF_SystemMenu_Index]  DEFAULT ((0)) FOR [IndexNum]
GO
ALTER TABLE [dbo].[SystemMenu] ADD  CONSTRAINT [DF_SystemMenu_CreateAt]  DEFAULT (getdate()) FOR [CreateAt]
GO
ALTER TABLE [dbo].[SystemMenu] ADD  CONSTRAINT [DF_SystemMenu_IsDel]  DEFAULT ((0)) FOR [IsDel]
GO
ALTER TABLE [dbo].[SystemRole] ADD  CONSTRAINT [DF_SystemRole_CreateAt]  DEFAULT (getdate()) FOR [CreateAt]
GO
ALTER TABLE [dbo].[SystemRole] ADD  CONSTRAINT [DF_SystemRole_IsDel]  DEFAULT ((0)) FOR [IsDel]
GO
ALTER TABLE [dbo].[SystemRoleFunction] ADD  CONSTRAINT [DF_SystemRoleFunction_CreateAt]  DEFAULT (getdate()) FOR [CreateAt]
GO
ALTER TABLE [dbo].[SystemRoleFunction] ADD  CONSTRAINT [DF_SystemRoleFunction_IsDel]  DEFAULT ((0)) FOR [IsDel]
GO
ALTER TABLE [dbo].[SystemUser] ADD  CONSTRAINT [DF_SystemUser_IsLogin]  DEFAULT ((0)) FOR [IsLogin]
GO
ALTER TABLE [dbo].[SystemUser] ADD  CONSTRAINT [DF_SystemUser_IsNormal]  DEFAULT ((1)) FOR [IsNormal]
GO
ALTER TABLE [dbo].[SystemUser] ADD  CONSTRAINT [DF_SystemUser_CreateAt]  DEFAULT (getdate()) FOR [CreateAt]
GO
ALTER TABLE [dbo].[SystemUser] ADD  CONSTRAINT [DF_SystemUser_IsDel]  DEFAULT ((0)) FOR [IsDel]
GO

CREATE TABLE [dbo].[ShopBaseKeyword](
	[Id] [int] IDENTITY(1,1) NOT NULL,
	[KeyCn] [varchar](100) NOT NULL,
	[KeyEn] [varchar](100) NULL,
	[KeyCh] [varchar](100) NULL,
	[Remarks] [varchar](2000) NULL,
	[CreateAt] [datetime] NOT NULL,
	[CreateName] [varchar](50) NOT NULL,
	[CreateId] [uniqueidentifier] NOT NULL,
	[UpdateAt] [datetime] NULL,
	[UpdateName] [varchar](50) NULL,
	[UpdateId] [uniqueidentifier] NULL,
	[IsDel] [bit] NULL,
 CONSTRAINT [PK_ShopBase] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

ALTER TABLE [dbo].[ShopBaseKeyword] ADD  CONSTRAINT [DF_ShopBase_CreateAt]  DEFAULT (getdate()) FOR [CreateAt]
GO

ALTER TABLE [dbo].[ShopBaseKeyword] ADD  CONSTRAINT [DF_ShopBase_IsDel]  DEFAULT ((0)) FOR [IsDel]
GO

CREATE TABLE [dbo].[ProductBaseType](
	[Id] [INT] IDENTITY(1,1) NOT NULL,
	[TypeCn] [VARCHAR](500) NOT NULL,
	[TypeEn] [VARCHAR](500) NULL,
	[TypeCh] [VARCHAR](500) NULL,
	[Remarks] [VARCHAR](2000) NULL,
	[ParentId] [INT] NULL,
	[IsShow] [BIT] NOT NULL,
	[Sort] [INT] NOT NULL,
	[CreateAt] [DATETIME] NOT NULL,
	[CreateName] [VARCHAR](50) NOT NULL,
	[CreateId] [UNIQUEIDENTIFIER] NOT NULL,
	[UpdateAt] [DATETIME] NULL,
	[UpdateName] [VARCHAR](50) NULL,
	[UpdateId] [UNIQUEIDENTIFIER] NULL,
	[IsDel] [BIT] NULL,
 CONSTRAINT [PK_ProductBaseType] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO

ALTER TABLE [dbo].[ProductBaseType] ADD  CONSTRAINT [DF_ProductBaseType_IsShow]  DEFAULT ((0)) FOR [IsShow]
GO

ALTER TABLE [dbo].[ProductBaseType] ADD  CONSTRAINT [DF_ProductBaseType_TypeNumber]  DEFAULT ((0)) FOR [Sort]
GO

ALTER TABLE [dbo].[ProductBaseType] ADD  CONSTRAINT [DF_ProductBaseType_CreateAt]  DEFAULT (GETDATE()) FOR [CreateAt]
GO

ALTER TABLE [dbo].[ProductBaseType] ADD  CONSTRAINT [DF_ProductBaseType_IsDel]  DEFAULT ((0)) FOR [IsDel]
GO

CREATE TABLE [dbo].[ProductBaseStandard](
	[Id] [INT] IDENTITY(1,1) NOT NULL,
	[ProductId] [INT] NOT NULL,
	[Title] [VARCHAR](200) NULL,
	[Standard] [VARCHAR](MAX) NULL,
	[Introduction] [VARCHAR](MAX) NULL,
	[PackListRemark] [VARCHAR](500) NULL,
	[IsShow] [BIT] NOT NULL,
	[Sort] [INT] NOT NULL,
	[CreateAt] [DATETIME] NOT NULL,
	[CreateName] [VARCHAR](50) NOT NULL,
	[CreateId] [UNIQUEIDENTIFIER] NOT NULL,
	[UpdateAt] [DATETIME] NULL,
	[UpdateName] [VARCHAR](50) NULL,
	[UpdateId] [UNIQUEIDENTIFIER] NULL,
	[IsDel] [BIT] NULL,
 CONSTRAINT [PK_ProductBaseStandard] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO

ALTER TABLE [dbo].[ProductBaseStandard] ADD  CONSTRAINT [DF_ProductBaseStandard_IsShow]  DEFAULT ((0)) FOR [IsShow]
GO

ALTER TABLE [dbo].[ProductBaseStandard] ADD  CONSTRAINT [DF_ProductBaseStandard_Sort]  DEFAULT ((0)) FOR [Sort]
GO

ALTER TABLE [dbo].[ProductBaseStandard] ADD  CONSTRAINT [DF_ProductBaseStandard_CreateAt]  DEFAULT (GETDATE()) FOR [CreateAt]
GO

ALTER TABLE [dbo].[ProductBaseStandard] ADD  CONSTRAINT [DF_ProductBaseStandard_IsDel]  DEFAULT ((0)) FOR [IsDel]
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'规格' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'ProductBaseStandard', @level2type=N'COLUMN',@level2name=N'Standard'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'产品介绍' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'ProductBaseStandard', @level2type=N'COLUMN',@level2name=N'Introduction'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'包装与清单说明' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'ProductBaseStandard', @level2type=N'COLUMN',@level2name=N'PackListRemark'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'产品规格' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'ProductBaseStandard'
GO

CREATE TABLE [dbo].[ProductBasePrice](
	[Id] [INT] NOT NULL,
	[StandardId] [INT] NULL,
	[Title] [VARCHAR](50) NOT NULL,
	[SourcePrice] [DECIMAL](18, 2) NULL,
	[SellPrice] [DECIMAL](18, 2) NULL,
	[IsShow] [BIT] NOT NULL,
	[Sort] [INT] NOT NULL,
	[CreateAt] [DATETIME] NOT NULL,
	[CreateName] [VARCHAR](50) NOT NULL,
	[CreateId] [UNIQUEIDENTIFIER] NOT NULL,
	[UpdateAt] [DATETIME] NULL,
	[UpdateName] [VARCHAR](50) NULL,
	[UpdateId] [UNIQUEIDENTIFIER] NULL,
	[IsDel] [BIT] NULL
) ON [PRIMARY]
GO

ALTER TABLE [dbo].[ProductBasePrice] ADD  CONSTRAINT [DF_ProductBasePrice_IsShow]  DEFAULT ((0)) FOR [IsShow]
GO

ALTER TABLE [dbo].[ProductBasePrice] ADD  CONSTRAINT [DF_ProductBasePrice_Sort]  DEFAULT ((0)) FOR [Sort]
GO

ALTER TABLE [dbo].[ProductBasePrice] ADD  CONSTRAINT [DF_ProductBasePrice_CreateAt]  DEFAULT (GETDATE()) FOR [CreateAt]
GO

ALTER TABLE [dbo].[ProductBasePrice] ADD  CONSTRAINT [DF_ProductBasePrice_IsDel]  DEFAULT ((0)) FOR [IsDel]
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'规格Id' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'ProductBasePrice', @level2type=N'COLUMN',@level2name=N'StandardId'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'价格名称' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'ProductBasePrice', @level2type=N'COLUMN',@level2name=N'Title'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'成本价' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'ProductBasePrice', @level2type=N'COLUMN',@level2name=N'SourcePrice'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'售价' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'ProductBasePrice', @level2type=N'COLUMN',@level2name=N'SellPrice'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'产品价格' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'ProductBasePrice'
GO

CREATE TABLE [dbo].[ProductBaseNew](
	[Id] [INT] IDENTITY(1,1) NOT NULL,
	[ProductId] [INT] NOT NULL,
	[IsShow] [BIT] NOT NULL,
	[Sort] [INT] NOT NULL,
	[CreateAt] [DATETIME] NOT NULL,
	[CreateName] [VARCHAR](50) NOT NULL,
	[CreateId] [UNIQUEIDENTIFIER] NOT NULL,
	[UpdateAt] [DATETIME] NULL,
	[UpdateName] [VARCHAR](50) NULL,
	[UpdateId] [UNIQUEIDENTIFIER] NULL,
	[IsDel] [BIT] NULL,
 CONSTRAINT [PK_ProductBaseNew] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO

ALTER TABLE [dbo].[ProductBaseNew] ADD  CONSTRAINT [DF_ProductBaseNew_IsShow]  DEFAULT ((0)) FOR [IsShow]
GO

ALTER TABLE [dbo].[ProductBaseNew] ADD  CONSTRAINT [DF_ProductBaseNew_Sort]  DEFAULT ((0)) FOR [Sort]
GO

ALTER TABLE [dbo].[ProductBaseNew] ADD  CONSTRAINT [DF_ProductBaseNew_CreateAt]  DEFAULT (GETDATE()) FOR [CreateAt]
GO

ALTER TABLE [dbo].[ProductBaseNew] ADD  CONSTRAINT [DF_ProductBaseNew_IsDel]  DEFAULT ((0)) FOR [IsDel]
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'新品' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'ProductBaseNew'
GO

CREATE TABLE [dbo].[ProductBaseImage](
	[Id] [INT] IDENTITY(1,1) NOT NULL,
	[ProductId] [INT] NULL,
	[NameCn] [VARCHAR](50) NULL,
	[NameEn] [VARCHAR](100) NULL,
	[NameCh] [VARCHAR](50) NULL,
	[Url] [VARCHAR](200) NULL,
	[Alt] [VARCHAR](200) NULL,
	[IsShow] [BIT] NOT NULL,
	[Sort] [INT] NOT NULL,
	[CreateAt] [DATETIME] NOT NULL,
	[CreateName] [VARCHAR](50) NOT NULL,
	[CreateId] [UNIQUEIDENTIFIER] NOT NULL,
	[UpdateAt] [DATETIME] NULL,
	[UpdateName] [VARCHAR](50) NULL,
	[UpdateId] [UNIQUEIDENTIFIER] NULL,
	[IsDel] [BIT] NULL,
 CONSTRAINT [PK_ProductBaseImage] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO

ALTER TABLE [dbo].[ProductBaseImage] ADD  CONSTRAINT [DF_ProductBaseImage_IsShow]  DEFAULT ((0)) FOR [IsShow]
GO

ALTER TABLE [dbo].[ProductBaseImage] ADD  CONSTRAINT [DF_ProductBaseImage_Sort]  DEFAULT ((0)) FOR [Sort]
GO

ALTER TABLE [dbo].[ProductBaseImage] ADD  CONSTRAINT [DF_ProductBaseImage_CreateAt]  DEFAULT (GETDATE()) FOR [CreateAt]
GO

ALTER TABLE [dbo].[ProductBaseImage] ADD  CONSTRAINT [DF_ProductBaseImage_IsDel]  DEFAULT ((0)) FOR [IsDel]
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'唯一标示' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'ProductBaseImage', @level2type=N'COLUMN',@level2name=N'Id'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'产品图片' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'ProductBaseImage'
GO

CREATE TABLE [dbo].[ProductBaseHot](
	[Id] [INT] IDENTITY(1,1) NOT NULL,
	[ProductId] [INT] NOT NULL,
	[IsShow] [BIT] NOT NULL,
	[Sort] [INT] NOT NULL,
	[CreateAt] [DATETIME] NOT NULL,
	[CreateName] [VARCHAR](50) NOT NULL,
	[CreateId] [UNIQUEIDENTIFIER] NOT NULL,
	[UpdateAt] [DATETIME] NULL,
	[UpdateName] [VARCHAR](50) NULL,
	[UpdateId] [UNIQUEIDENTIFIER] NULL,
	[IsDel] [BIT] NULL,
 CONSTRAINT [PK_ProductBaseHot] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO

ALTER TABLE [dbo].[ProductBaseHot] ADD  CONSTRAINT [DF_ProductBaseHot_IsShow]  DEFAULT ((0)) FOR [IsShow]
GO

ALTER TABLE [dbo].[ProductBaseHot] ADD  CONSTRAINT [DF_ProductBaseHot_Sort]  DEFAULT ((0)) FOR [Sort]
GO

ALTER TABLE [dbo].[ProductBaseHot] ADD  CONSTRAINT [DF_ProductBaseHot_CreateAt]  DEFAULT (GETDATE()) FOR [CreateAt]
GO

ALTER TABLE [dbo].[ProductBaseHot] ADD  CONSTRAINT [DF_ProductBaseHot_IsDel]  DEFAULT ((0)) FOR [IsDel]
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'火爆商品' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'ProductBaseHot'
GO

CREATE TABLE [dbo].[ProductBaseComment](
	[Id] [INT] IDENTITY(1,1) NOT NULL,
	[ProductId] [INT] NULL,
	[CommentText] [VARCHAR](2000) NULL,
	[AnswerText] [VARCHAR](2000) NULL,
	[Status] [INT] NULL,
	[Sort] [INT] NOT NULL,
	[CreateAt] [DATETIME] NOT NULL,
	[CreateName] [VARCHAR](50) NOT NULL,
	[CreateId] [UNIQUEIDENTIFIER] NOT NULL,
	[UpdateAt] [DATETIME] NULL,
	[UpdateName] [VARCHAR](50) NULL,
	[UpdateId] [UNIQUEIDENTIFIER] NULL,
	[IsDel] [BIT] NULL,
 CONSTRAINT [PK_ProductBaseComment] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO

ALTER TABLE [dbo].[ProductBaseComment] ADD  CONSTRAINT [DF_ProductBaseComment_Sort]  DEFAULT ((0)) FOR [Sort]
GO

ALTER TABLE [dbo].[ProductBaseComment] ADD  CONSTRAINT [DF_ProductBaseComment_CreateAt]  DEFAULT (GETDATE()) FOR [CreateAt]
GO

ALTER TABLE [dbo].[ProductBaseComment] ADD  CONSTRAINT [DF_ProductBaseComment_IsDel]  DEFAULT ((0)) FOR [IsDel]
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'审核状态' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'ProductBaseComment', @level2type=N'COLUMN',@level2name=N'Status'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'商品评论' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'ProductBaseComment'
GO

CREATE TABLE [dbo].[ProductBaseBrand](
	[Id] [INT] IDENTITY(1,1) NOT NULL,
	[BrandCn] [VARCHAR](500) NOT NULL,
	[BrandEn] [VARCHAR](500) NULL,
	[BrandCh] [VARCHAR](500) NULL,
	[Remarks] [VARCHAR](2000) NULL,
	[IsShow] [BIT] NOT NULL,
	[IsHot] [BIT] NULL,
	[Sort] [INT] NOT NULL,
	[CreateAt] [DATETIME] NOT NULL,
	[CreateName] [VARCHAR](50) NOT NULL,
	[CreateId] [UNIQUEIDENTIFIER] NOT NULL,
	[UpdateAt] [DATETIME] NULL,
	[UpdateName] [VARCHAR](50) NULL,
	[UpdateId] [UNIQUEIDENTIFIER] NULL,
	[IsDel] [BIT] NULL,
 CONSTRAINT [PK_ProductBrand] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO

ALTER TABLE [dbo].[ProductBaseBrand] ADD  CONSTRAINT [DF_ProductBrand_IsShow]  DEFAULT ((0)) FOR [IsShow]
GO

ALTER TABLE [dbo].[ProductBaseBrand] ADD  CONSTRAINT [DF_ProductBrand_Sort]  DEFAULT ((0)) FOR [Sort]
GO

ALTER TABLE [dbo].[ProductBaseBrand] ADD  CONSTRAINT [DF_ProductBrand_CreateAt]  DEFAULT (GETDATE()) FOR [CreateAt]
GO

ALTER TABLE [dbo].[ProductBaseBrand] ADD  CONSTRAINT [DF_ProductBrand_IsDel]  DEFAULT ((0)) FOR [IsDel]
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'是否热门品牌' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'ProductBaseBrand', @level2type=N'COLUMN',@level2name=N'IsHot'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'产品品牌' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'ProductBaseBrand'
GO


CREATE TABLE [dbo].[ProductBase](
	[Id] [INT] IDENTITY(1,1) NOT NULL,
	[NameCn] [VARCHAR](200) NOT NULL,
	[NameEn] [VARCHAR](200) NULL,
	[NameCh] [VARCHAR](500) NULL,
	[Sku] [VARCHAR](50) NULL,
	[Code] [VARCHAR](50) NULL,
	[BrandId] [INT] NULL,
	[TypeId] [INT] NULL,
	[Remarks] [VARCHAR](2000) NULL,
	[WarningStore] [INT] NULL,
	[Status] [INT] NULL,
	[StartShelf] [DATETIME] NULL,
	[EndShelf] [DATETIME] NULL,
	[CountryOrigin] [INT] NULL,
	[Sort] [NCHAR](10) NULL,
	[CreateAt] [DATETIME] NOT NULL,
	[CreateName] [VARCHAR](50) NOT NULL,
	[CreateId] [UNIQUEIDENTIFIER] NOT NULL,
	[UpdateAt] [DATETIME] NULL,
	[UpdateName] [VARCHAR](50) NULL,
	[UpdateId] [UNIQUEIDENTIFIER] NULL,
	[IsDel] [BIT] NULL,
 CONSTRAINT [PK_ProductBase] PRIMARY KEY CLUSTERED 
(
	[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO

ALTER TABLE [dbo].[ProductBase] ADD  CONSTRAINT [DF_ProductBase_CreateAt]  DEFAULT (GETDATE()) FOR [CreateAt]
GO

ALTER TABLE [dbo].[ProductBase] ADD  CONSTRAINT [DF_ProductBase_IsDel]  DEFAULT ((0)) FOR [IsDel]
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'状态 0 上架 1 下架 2 预售 3 秒杀' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'ProductBase', @level2type=N'COLUMN',@level2name=N'Status'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'上架时间' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'ProductBase', @level2type=N'COLUMN',@level2name=N'StartShelf'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'下架时间' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'ProductBase', @level2type=N'COLUMN',@level2name=N'EndShelf'
GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'产品基础' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'ProductBase'
GO


